package com.netcraftsstudio.maven.utility;

import com.netcraftsstudio.maven.utility.DetermineMavenDependenciesTool;

import groovy.util.GroovyTestCase;

class DetermineMavenDependenciesToolTest extends GroovyTestCase {

	def tested = new DetermineMavenDependenciesTool()
	
	def inputJar = "commons-logging.jar"
	
	def expectedSha1Hash = "760c711c71588bc273d3e56d196d720a7678cd93"
	
	
	void testCalculateSha1() {
		
		def jarFile = new File("src/test/resources/commons-logging.jar")
		assertEquals expectedSha1Hash, tested.calculateSha1(jarFile)
	}
	

	void testGetMavenCoordinates() {
		
		assertEquals "<dependency><groupId>commons-logging</groupId><artifactId>commons-logging</artifactId><version>1.0.3</version></dependency>", 
			tested.getMavenCoordinates(expectedSha1Hash, inputJar)
	}
	
		
}
